{template 'common/header'}

<ul class="nav nav-tabs">

	<li><a href="{php echo $this->createWebUrl('goods')}">商品列表</a></li>

	<li class="active"><a href="{php echo $this->createWebUrl('addgoods')}">添加商品</a></li>

	<li><a href="{php echo $this->createWebUrl('indexsort')}">首页商品分类</a></li>
	<li><a href="{php echo $this->createWebUrl('indexsort_post')}">添加首页商品分类</a></li>
	<li><a href="{php echo $this->createWebUrl('sort')}">商品分类</a></li>
	<li><a href="{php echo $this->createWebUrl('sort_post')}">添加商品分类</a></li>

</ul>



<div class="clearfix">

	<form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" onsubmit="return formcheck()" style="">

		<input type="hidden" name="id" value="{$info['id']}">

		<div class="panel panel-default" style="">

			<div class="panel-heading">

				编辑商品

			</div>

			<div class="panel-body" style="">

				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>商品名</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="goods_name" id="advname" class="form-control" value="{$info['goods_name']}">
					</div>
				</div>
                
                <div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label"><span style="color:red">*</span>商品图</label>
					<div class="col-sm-8">
						{php echo tpl_form_field_image('main_img',$info['main_img']);}
						<div style="color: red !important;">建议比例：200*200 。
					    </div>
					</div>
				</div>
				<div class="form-group">
	                <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>商品图集</label>
	                <div class="col-sm-9">
	                    {php echo tpl_form_field_multi_image('goods_img',$info['goods_img'])}
	                    <div class='help-block'>商品详情轮播图</div>
	                </div>
                </div>
                <div class="form-group">
	                <label class="col-xs-6 col-sm-3 col-md-2 control-label">首页分类</label>
					<div class="col-md-6 mathyts ">
	                       <select name="indexsort_id" class="form-control form-control_s" >
	                           <option value="" {if $info['indexsort_id']== ''}selected{/if}>首页分类列表</option>
	                           {loop $indexsort $index $data}                           
	                           <option value="{$data['id']}" {if $info['indexsort_id'] == $data['id']}selected{/if}>{$data['advname']}</option>
	                           {/loop}
	                       </select>
	                </div>	
                </div>
                <div class="form-group">
	                <label class="col-xs-6 col-sm-3 col-md-2 control-label">商品分类</label>
					<div class="col-md-6 mathyts ">
	                       <select name="sort_id" class="form-control form-control_s" >
	                           <option value="" {if $info['sort_id']== ''}selected{/if}>分类列表</option>
	                           {loop $sort $index $data}                           
	                           <option value="{$data['id']}" {if $info['sort_id'] == $data['id']}selected{/if}>{$data['advname']}</option>
	                           {/loop}
	                       </select>
	                </div>	
                </div>
                <div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">出售方式</label>
					<div class="col-sm-9 col-xs-12" id="huan">
						<label class="radio-inline">
							<input type="radio" name="selltype" {if $info['selltype'] == 0} checked {/if} value="0">普通
						</label>
						<label class="radio-inline">
							<input type="radio" name="selltype" value="1"  {if $info['selltype'] == 1} checked {/if}>核销
						</label>
						<label class="radio-inline">
							<input type="radio" name="selltype" value="2"  {if $info['selltype'] == 2} checked {/if}>邀请满x好友得商品
						</label>
						<label class="radio-inline">
							<input type="radio" name="selltype" value="3"  {if $info['selltype'] == 3} checked {/if}>邀请x好友核销
						</label>
					</div>
				</div>
				<div class="form-group shop">
	                <label class="col-xs-6 col-sm-3 col-md-2 control-label">门店选择</label>
					<div class="col-md-6 mathyts ">
	                       <select name="shop_id" class="form-control form-control_s" >
	                           <option value="" {if $info['shop_id']== ''}selected{/if}>门店列表</option>
	                           {loop $shop $index $data}                           
	                           <option value="{$data['id']}" {if $info['shop_id'] == $data['id']}selected{/if}>{$data['shopname']}</option>
	                           {/loop}
	                       </select>
	                </div>	
                </div>
                <div class="form-group shop">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">有效期</label>
					<div class="col-sm-3 col-xs-3">
						<div class="input-group">
							<input type="text" name="validity" class="form-control" value="{$info['validity']}">
							<div class='input-group-addon'>天</div>
						</div>
					</div>
				</div>
                <div class="form-group type">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">支付方式</label>
					<div class="col-sm-9 col-xs-12" id="qie">
						<label class="radio-inline">
							<input type="radio" name="paytype" {if $info['paytype'] == 0} checked {/if} value="0">步数币
						</label>
						<label class="radio-inline">
							<input type="radio" name="paytype" value="1"  {if $info['paytype'] == 1} checked {/if}>步数币+人民币
						</label>
					</div>
				</div>
				<div class="form-group people">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>邀请满x新人可以免费兑换商品</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="minpeople" id="advname" class="form-control" value="{$info['minpeople']}">
					</div>
				</div>
                <div class="form-group one">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>价格(步数币)</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="price" id="advname" class="form-control" value="{$info['price']}">
					</div>
				</div>
				<div class="form-group two">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>价格(步数币)</label>
					<div class="col-sm-3 col-xs-12">
						<input type="text" id="advname" name="price2" class="form-control" value="{$info['price2']}">
					</div>
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>人民币</label>
					<div class="col-sm-3 col-xs-12">
						<input type="text" id="advname" name="rmb" class="form-control" value="{$info['rmb']}">
					</div>
				</div>
				<div class="form-group three">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>人民币原价</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="maxrmb" id="advname" class="form-control" value="{$info['maxrmb']}">
					</div>
				</div>
				<div class="form-group type">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否可以使用红包</label>
					<div class="col-sm-9 col-xs-12" >
						<label class="radio-inline">
							<input type="radio" name="is_hongbao" {if $info['is_hongbao'] == 0} checked {/if} value="0">不可以
						</label>
						<label class="radio-inline">
							<input type="radio" name="is_hongbao" value="1"  {if $info['is_hongbao'] == 1} checked {/if}>可以
						</label>
						<div class='help-block'>如果选择可以使用红包，则用户可以用红包裂变得来的红包余额抵扣购买商品。只有原价购买时可以用红包抵扣。</div>
					</div>
				</div>
				<div class="form-group three">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>红包抵扣上限</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="maxhongbao" id="advname" class="form-control" value="{$info['maxhongbao']}">
						<div class='help-block'>红包抵扣上限不要超过商品人民币原价</div>
					</div>
				</div>
                
                <div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>每人最大购买次数</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="maxbuy" id="advname" class="form-control" value="{$info['maxbuy']}">
						<div class='help-block'>0为不限制购买次数。邀请好友模式默认只能兑换一次</div>
					</div>
				</div>
                <div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>库存</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="inventory" id="advname" class="form-control" value="{$info['inventory']}">
					</div>
				</div>
                
                <div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>快递说明</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="express" id="advname" class="form-control" value="{$info['express']}">
						<div class='help-block'>如：全国包邮</div>
					</div>
				</div>

				<div class="form-group" style="">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">商品详情</label>
					<div class="col-sm-9 col-xs-12">
						{php echo tpl_ueditor('goodsinfo',$info['goodsinfo']);}
					</div>
				</div>

				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="displayorder" class="form-control" value="{$info['displayorder']}">
					</div>
				</div>

				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否上架</label>
					<div class="col-sm-9 col-xs-12">
						<label class="radio-inline">
							<input type="radio" name="status"{if $info['status'] == 1} checked {/if} value="1"> 是
						</label>
						<label class="radio-inline">
							<input type="radio" name="status" value="0"  {if $info['status'] != 1} checked {/if}> 否
						</label>
					</div>
				</div>

			</div>

		</div>

		<div class="form-group col-sm-12">

			{if empty($info['id'])}

				<input type="hidden" name="act" value="add">

			{else}

				<input type="hidden" name="act" value="edit">

			{/if}

			<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1">

		</div>

	</form>

</div>

<script type="text/javascript">
	$('#qie').find('label').each(function(){			
		$(this).click(function(){
			var index=$(this).index()
			if(index==0){
				$('.one').show()
				$('.two').hide()
				$('.three').hide()
			}else if(index==1){
				$('.one').hide()
				$('.two').show()
				$('.three').show()
			}
		})
	})
	var index = $('#qie label').find(':radio:checked').val();
	        if(index==0){
				$('.one').show()
				$('.two').hide()
				$('.three').hide()
			}else if(index==1){
				$('.one').hide()
				$('.two').show()
				$('.three').show()
			}
</script>
<script type="text/javascript">
	$('#huan').find('label').each(function(){			
		$(this).click(function(){
			var index=$(this).index()
			if(index==0){
				$('.shop').hide()
				$('.people').hide()
				$('.type').show()
			}else if(index==1){
				$('.shop').show()
				$('.people').hide()
				$('.type').show()
			}
			else if(index==2){
				$('.shop').hide()
				$('.people').show()
				$('.type').hide()
				$('.one').hide()
				$('.two').hide()
				$('.three').hide()
			}
			else if(index==3){
				$('.shop').show()
				$('.people').show()
				$('.type').hide()
				$('.one').hide()
				$('.two').hide()
				$('.three').hide()
			}
		})
	})
	var index = $('#huan label').find(':radio:checked').val();
	        if(index==0){
				$('.shop').hide()
				$('.people').hide()
				$('.type').show()
				/*$('.one').hide()
				$('.two').hide()
				$('.three').hide()*/
			}else if(index==1){
				$('.shop').show()
				$('.people').hide()
				$('.type').show()
				/*$('.one').hide()
				$('.two').hide()
				$('.three').hide()*/
			}
			else if(index==2){
				$('.shop').hide()
				$('.people').show()
				$('.type').hide()
				$('.one').hide()
				$('.two').hide()
				$('.three').hide()
			}
			else if(index==3){
				$('.shop').show()
				$('.people').show()
				$('.type').hide()
				$('.one').hide()
				$('.two').hide()
				$('.three').hide()
			}
</script>

{template 'common/footer'}